import Vue from 'vue'
import './plugins/axios'
// import axios  from './request/request'
import App from './App.vue'
import router from './router'
import store from './store'
import 'amfe-flexible'
import '@/assets/css/common.css'
import '@/assets/animate/animate.min.css'
import './common.scss'
import '@/assets/font/font.css'
import '@/assets/webfont/webfont.css'
import VueWeChatTitle from "vue-wechat-title"
import Button from 'vant/lib/button';
import { List } from 'vant';
import 'vant/lib/button/style';
import { Search } from 'vant'
import { Tab, Tabs } from 'vant';
import { Icon } from 'vant'
import { Dialog } from 'vant';
import { Lazyload } from 'vant';
import { PullRefresh } from 'vant'
import { Loading } from 'vant';
import { Swipe, SwipeItem } from 'vant';
import { Toast } from 'vant'
Vue.use(VueWeChatTitle);
Vue.use(Swipe);
Vue.use(SwipeItem);







Vue.use(Lazyload, {
  lazyComponent: true,
  loading:require("./assets/icon/common/img_load.png"),
  error:require("./assets/icon/common/img_load.png")
});
Vue.use(Button)
Vue.use(Tab).use(Tabs)
Vue.use(Search)
Vue.use(Icon)  
Vue.use(Dialog)   
Vue.use(List)   
Vue.use(PullRefresh)   
Vue.use(Loading)   
Vue.use(Toast)   
// Vue.use(axios)
Toast.setDefaultOptions({ duration: 500 });


// 引入button组件、dialog组件
import TmButton from "./components/button/TmButton.vue"
import TmDialog from "@/components/dialog/TmDialog.vue"
import HomeNav  from "@/components/homenav/HomeNav.vue"
import HeaderSearch from "@/components/header_search/HeaderSearch.vue"
import TabBar from "@/components/homenav/TabBar.vue"
import NavBar from "@/components/navbar/NavBar.vue"
import DownloadImg from "@/components/dowmload/DownloadApp.vue"
import XyContent from "@/components/content/XyContent.vue"
import DItem from "@/components/content/DItem.vue"
import RecomContent from "@/components/content/RecomContent.vue"
import MyFooter from "@/components/footer/MyFooter.vue"
import MySwiper from "@/components/swiper/MySwiper.vue"
import MyLoad from "@/components/load/MyLoad.vue"
import TopOpen from "@/components/openapp/TopOpen.vue"
import ShouOpen from "@/components/openapp/ShouOpen.vue"
import CTitle from "@/components/content/CTitle.vue"
import VItem from "@/components/content/VItem.vue"
import CItem from "@/components/content/CItem.vue"
import UItem from "@/components/content/UItem.vue"
import RItem from "@/components/content/RItem.vue"
import FloatOpen from "@/components/openapp/FloatOpen.vue"
import PagePlay from "@/components/play/PagePlay.vue"
import JItem from "@/views/album/albumcomp/JItem.vue"
import XsAlbum from "@/views/album/albumcomp/XsAlbum.vue"
import JdAlbum from "@/views/album/albumcomp/JdAlbum.vue"
import ZbComp from "@/views/album/albumcomp/ZbComp.vue"
import VipComp from "@/views/album/albumcomp/VipComp.vue"
import GoLogin from "@/views/album/albumcomp/GoLogin.vue"
import RankLoad from "@/components/dowmload/MyLoad.vue"


Vue.component('tm-button',TmButton)
Vue.component('tm-dialog',TmDialog)
Vue.component('home-nav',HomeNav)
Vue.component('nav-bar',NavBar)
Vue.component('header-search',HeaderSearch)
Vue.component('download-img',DownloadImg)
Vue.component('xy-content',XyContent)
Vue.component('my-footer',MyFooter)
Vue.component('top-open',TopOpen)
Vue.component('shou-open',ShouOpen)
Vue.component('v-item',VItem) 
Vue.component('c-title',CTitle) 
Vue.component('float-open',FloatOpen) 
Vue.component('page-play',PagePlay) 
Vue.component('j-item',JItem) 
Vue.component('c-item',CItem) 
Vue.component('xs-album',XsAlbum) 
Vue.component('jd-album',JdAlbum) 
Vue.component('zb-comp',ZbComp) 
Vue.component('tab-bar',TabBar) 
Vue.component('r-item',RItem) 
Vue.component('rank-load',RankLoad) 
Vue.component('my-swiper',MySwiper) 
Vue.component('d-item',DItem) 
Vue.component('recom-content',RecomContent) 
Vue.component('my-load',MyLoad) 
Vue.component('vip-comp',VipComp) 
Vue.component('go-login',GoLogin) 
Vue.component('u-item',UItem) 

// 全局过滤器
Vue.filter('getCount',(val)=>{
  let v1 = val + ""
  if(v1.length > 8){
    return ((v1 - 0 ) / 100000000).toFixed(2)  + "亿"
  }else if(v1.length <= 8 && v1.length > 4){
    return ((v1 - 0 ) / 10000).toFixed(2)  + "万"
  }else{
    return v1 + " "
  }
})

Vue.filter('formatTime',(val)=>{
  let hh =parseInt(val / 60 / 60)
  let mm =parseInt(val / 60 % 60)   
  let ss =parseInt(val % 60)
  
  hh = hh < 10 ? "0"+hh : hh
  ss = ss < 10 ? "0"+ss : ss
  mm = mm < 10 ? "0"+mm : mm
  let str = ``
  if( hh == "00"){
     str = `${mm}:${ss}`
  }else{
     str = `${hh}:${mm}:${ss}`
  }

  return str
})

Vue.filter('getDetailTime',(val)=>{
   
    let dt = new Date(val)

    let yy = dt.getFullYear()
    let mm = dt.getMonth()+1
    let dd = dt.getDay()

    let str = `${yy}-${mm}-${dd}`
    return str
 
})
Vue.filter('getTxt',(val)=>{
  let str = ""
   if(val.length >= 80){
     str = val.slice(0,80) + '...'

   }else{
     str = val
   }
  
   return str
})



Vue.config.productionTip = false

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
